UITableView not reloading data on [self.tableView reloadData]

Posted by donnib on Stack Overflow See other posts from Stack Overflow or by donnib
Published on 2010-05-12T20:55:46Z Indexed on 2010/05/12 21:44 UTC
Read the original article Hit count: 677

Filed under:
|

I have following code :

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = [indexPath row];
static NSString *RowListCellIdentifier = @"RowListCellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:RowListCellIdentifier];

if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:RowListCellIdentifier]autorelease];
}

NSMutableString *rowString = [[NSMutableString alloc] init];
[rowString appendString:[[[rows objectAtIndex:row] firstNumber]stringValue]];
[rowString appendString:@" : "];
[rowString appendString:[[[rows objectAtIndex:row] secondNumber]stringValue]];
[rowString appendString:@" : "];
[[cell textLabel] setText:rowString];

[rowString release];
return cell;
}

- (void)viewWillAppear:(BOOL)animated {
    [self.tableView reloadData]; 
    [super viewWillAppear:animated];
}

My problem is that the textLabel does not get reloaded with new data. If i log the rowString i see the correct value so data is good but in the UI it's the old data. I can see the cellForRowAtIndexPath beeing called so i know the reloadDatacall goes thru. What am i doing wrong ?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c